package db

import (
	"gitee.com/showurl/push-rtmp/models"
	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
	"gorm.io/gorm/logger"
)

var DB *gorm.DB

func init() {
	var err error
	DB, err = gorm.Open(sqlite.Open(`sqlite3.db`), &gorm.Config{
		Logger: logger.Default.LogMode(logger.Error),
	})
	if err != nil {
		panic(err)
	}
	err = DB.AutoMigrate(
		&models.ModelCurrentInfo{},
	)
	if err != nil {
		panic(err)
	}
}
